/**
 * 
 */
package ua.kpi.javatrainee6.model.people;

import java.util.Arrays;
import java.util.Iterator;
import ua.kpi.javatrainee6.model.departments.*;

/**
 * Encapsulating logic for work with array of professors
 */
public class Professors implements Iterable<Professor> {
	
	private static final int PROFESSORS_NUMBER = 3;
	private Professor[] professors;
	
	/**
	 * filling professors array, 
	 * professors now are like {firstName1, lastName1, ...}, {firstName2, lastName2, ...}
	 * In the future it will be changed with real data from files, db ...
	 */
	public Professors(University univer, Groups groups) {
		professors = new Professor[PROFESSORS_NUMBER];
		for (int i = 0; i < PROFESSORS_NUMBER; i++) {
			professors[i] = new Professor(univer);
			professors[i].setGroups(groups);
		}	
	}
	
	private Professors(Professor[] professors) {
		this.professors = professors;
	}
	
	public Professor get(int index) {
		return professors[index];
	}
	
	public Professors copy() {
		return new Professors(professors.clone());
	}
	
	public Iterator<Professor> iterator() {
		return Arrays.asList(professors).iterator();
	}
}
